package cn.ncupyh.comptest;


import static java.lang.Math.pow;

//计算
public class Calculate {
    public static void main(String[] args) {
//        计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
        int p = -1;
        double sum = 0;
//        System.out.println(pow(p,2));
        for (int i = 1; i <= 100; i++) {
            sum = sum + 1/(i*pow(p,i+1));
        }
        System.out.println(sum + "是本题答案");
    }
}
